package com.zqh.cli.commandPattern;

public class Client {


    public static void main(String[] args) {

        // 创建接受者对象
        Device TV = new Device("TV");

        // 创建具体命令,并且绑定设备
        TurnOffCommand turnOffCommand = new TurnOffCommand(TV);
        TurnOnCommand turnOnCommand = new TurnOnCommand(TV);

        // 创建调用者（遥控器）
        Controller controller = new Controller();

        // 设置命令，并按下按钮
        controller.setCommand(turnOnCommand);
        controller.pressButton();
        controller.setCommand(turnOffCommand);
        controller.pressButton();

    }

}
